﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewsEdit.aspx.cs" Inherits="SBACN.WebSite.Admin.NewsEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>内容编辑</title>
	<link href="images/style.css" rel="stylesheet" type="text/css" />
	<link href="images/form.css" rel="stylesheet" type="text/css" />
	<script type"text/javascript" src="/Scripts/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="/xheditor/xheditor-1.1.13-zh-cn.min.js"></script>
	<script type="text/javascript">
		var $jqy = jQuery.noConflict();
		function ImageNewsChecked(sender) {
			if (sender && sender.checked) {
				$jqy("#tr_ImageNews").show();
			}
			else {
				$jqy("#tr_ImageNews").hide();
			}
		}

		$jqy(pageInit);
		function pageInit() {
			if(<%= ExEdit.ToString().ToLower()%>)
				{
				$jqy('#txt_Content').xheditor({
					upLinkUrl: "/Handler/UploadHandler.ashx?tc=<%= SystemType%>",
					upLinkExt: "<%= UploadFileTypes%>",
					upImgUrl: "/Handler/UploadHandler.ashx?tc=<%= SystemType%>",
					upImgExt: "<%= UploadFileTypes%>",
					upFlashUrl: "/Handler/UploadHandler.ashx?tc=<%= SystemType%>",
					upFlashExt: "<%= UploadFileTypes%>",
					upMediaUrl: "/Handler/UploadHandler.ashx?tc=<%= SystemType%>",
					upMediaExt: "<%= UploadFileTypes%>",
					onUpload: insertUpload
				});
				$jqy("#tr_Attarchment").hide();
				$jqy("#tr_exOption").show();
				$jqy("#tr_Content").show();
				if(document.getElementById("chb_IsImageNews").checked)
				{
					$jqy("#tr_ImageNews").show();
				}
			}
			else
			{
				$jqy("#tr_Attarchment").show();
				$jqy("#tr_exOption").hide();
				$jqy("#tr_Content").hide();
				$jqy("#txt_Summary").height(375);
			}
		}
		function insertUpload(arrMsg) {
			var i, msg;
			for (i = 0; i < arrMsg.length; i++) {
				//msg = arrMsg[i];
			}
		}
		function ValidNewsInput()
		{
			var newTitle = $jqy("#txt_Title").val($jqy.trim($jqy("#txt_Title").val())).val();
			var newDate = $jqy("#txt_CreateDate").val($jqy.trim($jqy("#txt_CreateDate").val())).val();
			var pic = $jqy("#file_Image").val($jqy.trim($jqy("#file_Image").val())).val();
			if(newTitle.length == 0)
			{
				$jqy("#<%= lbl_Message.ClientID%>").html("标题不能为空!");
				return false;
			}

			if(newDate.length == 0)
			{
				$jqy("#<%= lbl_Message.ClientID%>").html("发布日期不能为空!");
				return false;
			}
			
			if(<%= ExEdit.ToString().ToLower()%> && ((document.getElementById("chb_IsImageNews").checked && pic.length == 0) && (!document.getElementById("linkMainPic") || document.getElementById("linkMainPic").href.length == 0)))
			{
				$jqy("#<%= lbl_Message.ClientID%>").html("图片新闻的图片不能为空!");
				return false;
			}

			return true;
		}
		function cancel() {
			if (window.opener != null) {
				window.opener = null;
			}
			window.close();
			return false;
		}
	</script>
</head>
<body>
    <form id="form1" runat="server">
	<center>
		<div id="contentDiv">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-stroke2">
		<tr>
			<td colspan="2" class="form-title2">
				<%= this.Header.Title%>
			</td>
		</tr>
		<tr>
			<td width="16%" class="form-label-1">
				<span style="color: Red">*</span>标题:</td>
			<td width="84%" class="form-body-1"><asp:TextBox TabIndex="0" ID="txt_Title" runat="server" MaxLength="500" Width="97%"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<td width="16%" class="form-label-1">
				<span style="color: Red">*</span>发布时间:
			</td>
			<td width="84%" class="form-body-1"><asp:TextBox ID="txt_CreateDate" CssClass="Wdate" runat="server" onClick="WdatePicker()" MaxLength="20" Width="120px"></asp:TextBox>
			
			</td>
		</tr>
		<tr>
			<td width="16%" class="form-label-1">摘要:
			</td>
			<td width="84%" class="form-body-1">
			<asp:TextBox ID="txt_Summary" runat="server" Rows="4" Width="98%" TextMode="MultiLine"></asp:TextBox>
			</td>
		</tr>
		<tr id="tr_Attarchment">
			<td width="16%" class="form-label-1">附件:
			</td>
			<td width="84%" class="form-body-1">
			<asp:FileUpload ID="file_Attarchment" runat="server" /><a href="" visible="false" target="_blank" runat="server" id="linkAttarchment">查看附件</a>
			</td>
		</tr>
		<tr id="tr_Content" style="display:none;">
			<td width="16%" class="form-label-1">内容:
			</td>
			<td width="84%" class="form-body-1">
			<asp:TextBox ID="txt_Content" runat="server" Height="270px" Width="98%" TextMode="MultiLine"></asp:TextBox>
			</td>
		</tr>
		<tr id="tr_exOption" style="display:none;">
			<td width="16%" class="form-label-1">
				其它选项:
			</td>
			<td width="84%" class="form-body-1">
				<asp:CheckBox ID="chb_IsPrivate" Text="必须登录后阅读" runat="server" />&nbsp;&nbsp;
				<asp:CheckBox ID="chb_IsAutoScroll" Text="发布到滚动公告" runat="server" />&nbsp;&nbsp;
				<asp:CheckBox ID="chb_IsImageNews" Text="发布到图片新闻" runat="server" onclick="return ImageNewsChecked(this);" />
			</td>
		</tr>
		<tr id="tr_ImageNews" style="display: none;">
			<td width="16%" class="form-label-1">
				图片:
			</td>
			<td width="84%" class="form-body-1">
				<asp:FileUpload ID="file_Image" runat="server" />
				<span style="color: Red">(图片尺寸<%= ImageSize%>)*</span><a href="" visible="false" target="_blank" runat="server" clientidmode="Static" id="linkMainPic">查看图片</a>
			</td>
		</tr>
		<tr>
			<td class="form-body" colspan="2">
				<asp:Label ID="lbl_Message" Text="&nbsp;" runat="server" ForeColor="Red"></asp:Label><br />
				<asp:Button ID="btn_Save" CssClass="btnsearch" Text=" 确 定 " runat="server" OnClientClick="return ValidNewsInput();"  onclick="btn_Save_Click" />&nbsp;
				<asp:Button ID="btn_Cancel" CssClass="btnsearch" Text=" 关 闭 " runat="server" OnClientClick="return cancel();"
					 />
			</td>
		</tr>
	</table>
	</div>
	</center>
    </form>
</body>
</html>
